namespace deepClone {
    //深度拷贝 any js
    function deepClone(obj:any):any{
        if(!obj){
            return obj;
        }
        let clone:any = Array.isArray(obj) ? [] : {};
        for (const key in obj) {
            if (Object.prototype.hasOwnProperty.call(obj, key)) {
                if(obj[key] && ((typeof obj[key]) === 'object')){
                    clone[key] = deepClone(obj[key]);
                }else{
                    clone[key] = obj[key];
                }
            }
        }
        return clone;
    }
    let arr:any = {a:1,b:2}
    let arr2 = deepClone(arr)
    console.log(arr2 === arr);
}
